package com.dys.exercises;

import java.util.Scanner;

/**
 * @className: com.dys.exercises.ScannerTest
 * @description: TODO
 * @author: pine cone
 * @version: v1.0.0
 * @createTime: 2024/06/13 下午10:38
 */
public class ScannerTest {

    public static void main(String[] args) {
        enterStudentInformation();
    }

    /**
     * 键盘录入学生信息：姓名、性别、身高、年龄
     */
    public static void enterStudentInformation() {
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入学生的姓名：");
        String studentName = scanner.next();
        System.out.print("请输入学生的性别：");
        // 字符串可以录入多个,我只取第一个
        char sexStr = scanner.next().charAt(0);
        System.out.print("请输入学生的身高：");
        double height = scanner.nextDouble();
        System.out.print("请输入学生的年龄：");
        int age = scanner.nextInt();
        System.out.println("录入的学生信息如下：姓名：" + studentName + ",性别:" + sexStr + ",身高:" + height + ",年龄：" + age);
    }
}
